package org.stragma.symbian.units;

import org.stragma.apply.modules.ApplyParen;
import org.stragma.apply.signatures.Apply;
import org.stragma.apply.signatures.Apply.TModule;
import org.stragma.symbian.ITestable;
import org.stragma.symbian.apply.stratego.*;

/**
 * ApplyParenUnit represents ApplyParen as a testable unit wrapped in
 * an implementation of the strategy pattern
 * @author Shirren
 *
 */
public class ApplyParenUnit implements ITestable {

	/**
	 * Primary method for testing a Kiama unit in Stragma. For example
	 * Desugar would implement this method as it has been implemented in
	 * Stragma
	 */
	@Override
	public void testKiama(String testDataSource) {
		TModule res = (TModule)ApplyParen.parenthesizeApplyHelper(testDataSource, 1);
		Apply.TModuleToATerm(res);
	}

	/**
	 * Corollary to the Kiama unit this method is for testing Stratego
	 */
	@Override
	public void testStratego(String testDataSource) {
		String[] args = new String[]{"-i", testDataSource};
		Apply_parenJ.main(args);
	}

}
